QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Sprite Hit Testing

The Sprite Toolbox provides two functions for performing hit testing operations with sprites, SpriteWorldHitTest and SpriteHitTest .

The SpriteWorldHitTest function determines whether any sprites exist at a specified location in a sprite world's display coordinate system. This function retrieves the frontmost sprite at the specified location.

The SpriteHitTest function determines whether a particular sprite exists at a specified location in the sprite's display coordinate system. This function is useful for hit testing a subset of the sprites in a sprite world and for detecting multiple sprites at a single location.

For either hit test function, there are two flags, spriteHitTestBounds and spriteHitTestImage , that control the hit test operation. For example, you set just spriteHitTestBounds flag to check if there has been a hit anywhere within the sprite's bounding box, and you must set both flags to check if there has been a hit anywhere within the sprite image. These flags are described in "Flags for Sprite Hit Testing" .


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next